import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';

import {LoginComponent} from './pages/user/login/login.component'
import {RegisterComponent} from './pages/user/register/register.component'
import {PersonalComponent} from "./pages/user/personal/personal.component";
import {AuthGuard} from "./@core/guards/AuthGuard";
import {MyDiskComponent} from "./pages/disk/my-disk/my-disk.component";
import {NotFindComponent} from "./pages/not-find/not-find.component";
import {UserinfoComponent} from "./pages/user/userinfo/userinfo.component";
import {SettingComponent} from "./pages/user/setting/setting.component";
import { RegisterSuccessComponent } from './pages/user/register/register-success.component';
import {VideoPageComponent} from "@/app/pages/disk/file/video-page/video-page.component";
import {TextEditorComponent} from "@/app/pages/disk/file-list/text-editor/text-editor.component";
import {ShareDiskComponent} from "@/app/pages/disk/share-disk/share-disk.component";
import {FavoriteComponent} from "@/app/pages/user/favorite/favorite.component";
import {UserListComponent} from "@/app/pages/disk/share-disk/user-list/user-list.component";
import {UserDiskComponent} from "@/app/pages/disk/share-disk/user-disk/user-disk.component";
import {SearchFileListComponent} from "@/app/pages/disk/share-disk/search-file-list/search-file-list.component";
import {ClassificationComponent} from "@/app/pages/disk/classification/classification.component";

const routes: Routes = [
  {
    path:"user",
    children:[
      {
        path:"login",
        component:LoginComponent
      },
      {
        path:"personal",
        component:PersonalComponent,
        canActivate:[AuthGuard]
      },
      {
        path:"userinfo",
        component:UserinfoComponent,
        canActivate:[AuthGuard]
      },
      {
        path:"favorite",
        component:FavoriteComponent,
        canActivate:[AuthGuard]
      },
      {
        path:"setting",
        component:SettingComponent,
        canActivate:[AuthGuard],
      },
      {
        path:"register",
        component:RegisterComponent
      }
    ]
  },
  {
    path:"registerSuccess",
    component:RegisterSuccessComponent
  },
  {
    path:"classify",
    canActivate:[AuthGuard],
    children:[
      {
        path:'**',
        component: ClassificationComponent
      }
    ]
  },
  {
    path:"share",
    component:ShareDiskComponent,
    children:[
      {
        path: "file",
        component: SearchFileListComponent
      },
      {
        path: "user",
        component: UserListComponent
      },
      {
        path: "disk",
        children:[
          {
            path:'**',
            component: UserDiskComponent
          }
        ]
      },
      {
        path: "**",
        component: UserListComponent
      }
    ]
  },
  {
    path:"file",
    children:[
      {
        path: "video",
        component: VideoPageComponent
      }
    ]
  },
  {
    path:"myDisk",
    // component:MyDiskComponent,
    // loadChildren:() =>
    //   import('./pages/disk/my-disk/my-disk.module').then(
    //     (m) => m.MyDiskModule
    //   )
    canActivate:[AuthGuard],
    children:[
      {
        path: "test",
        component: TextEditorComponent
      },
      {
        path:"**",
        component:MyDiskComponent
      }
    ]
    // component:MyDiskComponent,
    // canActivate:[AuthGuard]
  },
  {
    path:"**",
    component:NotFindComponent
  }
];

@NgModule({
  imports: [RouterModule.forRoot(routes)],
  exports: [RouterModule]
})
export class AppRoutingModule { }
